package Ejemplos;
import javax.swing.*;
import java.awt.event.*;

public class ejemplo3_javaya extends JFrame implements ActionListener{
JButton boton1;
	public ejemplo3_javaya() {
		setLayout(null);
        boton1=new JButton("Finalizar");
        boton1.setBounds(300,250,100,30);
        add(boton1);
        boton1.addActionListener(this);
	}
	 public void actionPerformed(ActionEvent e) {
	        if (e.getSource()==boton1) {
	            System.exit(0);
	        }
	 }

	public static void main(String[] args) {
		 ejemplo3_javaya formulario1=new ejemplo3_javaya();
	        formulario1.setBounds(0,0,450,350);
	        formulario1.setVisible(true);

	}

}

/*import javax.swing.*;
import java.awt.event.*;
public class Formulario extends JFrame implements ActionListener {
    JButton boton1;
    public Formulario() {
        setLayout(null);
        boton1=new JButton("Finalizar");
        boton1.setBounds(300,250,100,30);
        add(boton1);
        boton1.addActionListener(this);
    }
    
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==boton1) {
            System.exit(0);
        }
    }
    
    public static void main(String[] ar) {
        Formulario formulario1=new Formulario();
        formulario1.setBounds(0,0,450,350);
        formulario1.setVisible(true);
    }
}
*/